package com.example.excel_util.export;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 导出测试
 *
 * @author BAO KANG
 * @date 2020/7/23 9:14
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @GetMapping
    public ModelAndView test(){
        List<Person>  people = new ArrayList<>();
        people.add(new Person("张是你",12));
        people.add(new Person("张是你",12));
        people.add(new Person("张是你",12));
        people.add(new Person("张是你",12));
        people.add(new Person("张是你",12));
        people.add(new Person("张是你",12));
        people.add(new Person("张是你",12));
        Map<String, Object> model = new HashMap<>();
        model.put("people", people);
        return new ModelAndView(new JxlsExcelView("people.xls","测试表"),model);
    }

}
